import 'package:app/page/login/entity/entity_login.dart';
import 'package:app/page/main/friend/entity/friend_entity.dart';

///
class EntityFactory {
  static T generateOBJ<T>(jsonStr) {
    if (jsonStr == null) {
      return null;
    } else if (T.toString() == "LoginEntity") {
      var bean = LoginEntity.fromJson(jsonStr as Map<String, dynamic>);
      return bean as T;
    } else if (T.toString() == "FriendEntity") {
      var bean = FriendEntity.fromJson(jsonStr as Map<String, dynamic>);
      return bean as T;
      // } else if (T.toString() == "ArticleModelEntity") {
      //   var bean = ArticleModelEntity().fromJson(jsonStr as Map<String, dynamic>);
      //   return bean as T;
    } else {
      return jsonStr as T;
    }
  }
}
